﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAO;
using DTO;
using System.Data;

namespace BUS
{
    public class TuyenBayBUS
    {
        public List<TuyenBayDTO> LayTuyenBay()
        {
           // TuyenBayDAO dao = new ChuyenBayDAO();
            TuyenBayDAO tbdao = new TuyenBayDAO();
            return tbdao.LayTuyenBay();
        }

        public TuyenBayDTO LayMotTuyenbay(string matb)
        {
            TuyenBayDAO tbdao = new TuyenBayDAO();
            return tbdao.LayMotTuyenBay(matb);
        }

        public int ThemTuyenBay(TuyenBayDTO tbdto)
        {
            TuyenBayDAO tbdao = new TuyenBayDAO();
            if(string.Compare(tbdto.SanBayDi,tbdto.SanBayDen)!=0)
                return tbdao.ThemTuyenBay(tbdto);
            return -1;
        }

        public int XoaTuyenBay(TuyenBayDTO tbdto)
        {
            TuyenBayDAO tbdao = new TuyenBayDAO();
            return tbdao.XoaTuyenBay(tbdto);
        }
    }
}
